hostAddress
Type
function
Summary
Returns the IP address of the local system a socket is connected to.
Syntax
the hostAddress of <socketID>
hostAddress(<socketID>)
Description
Use the hostAddress function to find the IP address of the computer that LiveCode is running on.
The socket must be open. If the specified socket has not been opened, the hostAddress function returns "not an open socket". If you have issued an open socket command to create the socket, you cannot use the hostAddress function until after the socket has been created and the command has completed.
The connectionID is needed only if more than one socket is connected to the same port of the same host. The connectionID is assigned by the accept or open socket command that created the socket.
Parameters
Name | Type | Description |
---|---|---|
socketID | The identifier (set when you opened the socket) of the socket you want to close. The socket identifier starts with the IP address of the host the socket is connected to, and may optionally include a port number (separated from the IP address by a colon). If there is more than one socket connected to that host and port, you can specify which socket by appending the connection name or number that was assigned when the socket was opened, separated from the port number by a vertical bar (|). |
Examples
the hostAddress of "www.example.com:80"
hostAddress("example.net:25|10")
the hostAddress of "127.0.0.1:8080|dataConnection"
Related
function: peerAddress, hostAddressToName, DNSServers
glossary: socket, host, IP address, command, return, port
command: accept, open socket
control structure: function
Compatibility and Support
Introduced
LiveCode 1.0
OS
mac
windows
linux
ios
android
Platforms
desktop
server
mobile